<?php
/**
 * /nmox/modules/Foxpaws.class.php
 * Foxpaws - the Faux Pas manager
 * 
 * @author David Christian Liedle <david.liedle@gmail.com>
 * @link   http://nmox.org/
 *
 */

class Foxpaws {
    
    // Manage all messages:
    var $errors;
    var $warnings;
    var $events;
    
    // Set desired notification level:
    var $notify_level = 1;
    // 0 = events
    // 1 = warnings
    // 2 = errors
    // 3 = email
    
    function set_notify_level($level){
        $this->notify_level = $level;
    }
    
    function add_error($error){
        // Register an error:
        $this->errors[] = $error;
    }
    
    function add_warning($warning){
        // Register a warning:
        $this->warnings[] = $warning;
    }
    
    function add_event($event){
        // Only tracks registered events
        $this->events[] = $event;
    }
    
    function yelp($msg){
        // Mainly for testing - this function simply
        // outputs an xhtml-formatted message
        echo "<h1>[YELP!] NMOX Alert Message: $msg</h1>\n";
    }
    
    function error_page($title, $error){
        // create a dedicated page to display errors
        global $myXHTML;
        if( !isset($myXHTML) ) $myXHTML = new XHTML;
        $myXHTML->set_title($title);
        $myXHTML->set_body("<p>$error</p>\n");
        $myXHTML->bake();
        $myXHTML->commit();
    }
    
    function log_db(){
        // log to database
    }
    
    function log_file(){
        // log to file
    }
    
    function email_notify($address, $notice){
        // send an email
        @mail($address, "NMOX System Notification", "NMOX System Notification: $notice");
    }
}

locateMe("/nmox/modules/Foxpaws.class.php");
